package com.chujian.sys.entity;

import com.baomidou.mybatisplus.annotation.KeySequence;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.chujian.SystemEchoConst;
import com.chujian.framework.annotation.echo.Echo;
import com.chujian.framework.core.IId;
import com.chujian.framework.core.base.BaseEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import lombok.experimental.Accessors;

import java.io.Serializable;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.HashMap;
import java.util.Map;

/**
 * @author chujian
 * @since 2021-10-11
 */
@Getter
@Setter
@ToString
@Accessors(chain = true)
@TableName("sys_user_login")
@KeySequence("sys_user_login_seq")
@ApiModel(value = "实体", description = "")
public class SysUserLogin extends BaseEntity implements IId, Serializable {

    private static final long serialVersionUID = 1L;

    @ApiModelProperty(value = "用户登录ID")
    @TableId("user_login_id")
    private Long userLoginId;

    @ApiModelProperty(value = "用户ID ")
    @TableField("user_id")
    @Echo(value = SystemEchoConst.userEchoService, targetField = "sysUserName")
    private Long userId;

    @ApiModelProperty(value = "用户真实姓名")
    @TableField("user_name")
    private String userName;

    @ApiModelProperty(value = "身份证")
    @TableField("id_card")
    private String idCard;

    @ApiModelProperty(value = "邮箱 ")
    @TableField("email")
    private String email;

    @ApiModelProperty(value = "手机号 ")
    @TableField("mobile")
    private String mobile;

    @ApiModelProperty(value = "出生日期")
    @TableField("birth")
    private LocalDate birth;

    @ApiModelProperty(value = "通信地址")
    @TableField("addr")
    private String addr;

    @ApiModelProperty(value = "性别（1：男 2:女） ")
    @TableField("sex")
    private Integer sex;

    @ApiModelProperty(value = "账套id")
    @TableField("ac_id")
    private Long acId;

    @ApiModelProperty(value = "公众号OPEN_ID ")
    @TableField("wx_mp_open_id")
    private String wxMpOpenId;

    @ApiModelProperty(value = "小程序OPEN_ID ")
    @TableField("wx_minip_open_id")
    private String wxMinipOpenId;

    @ApiModelProperty(value = "关联UNION_ID ")
    @TableField("wx_union_id")
    private String wxUnionId;

    @ApiModelProperty(value = "微信昵称")
    @TableField("wx_nickname")
    private String wxNickname;

    @ApiModelProperty(value = "微信头像")
    @TableField("wx_head_url")
    private String wxHeadUrl;

    @ApiModelProperty(value = "微信性别")
    @TableField("wx_gender")
    private String wxGender;

    @ApiModelProperty(value = "使用状态（0：禁用 1：启用） ")
    @TableField("status")
    private Boolean status;

    @ApiModelProperty(value = "查询项")
    @TableField("search_info")
    private String searchInfo;

    @TableField("login_type")
    private String loginType;

    @TableField("session_key")
    private String sessionKey;

    @ApiModelProperty(value = "绑定时间")
    @TableField("bind_time")
    private LocalDateTime bindTime;

    // ++++++ 系统拓展 +++++++
    @TableField(exist = false)
    private Map<String, String> query = new HashMap<>();

    @Override
    public Long getId() {
        return this.userLoginId;
    }

    @Override
    public void setId(Serializable id) {
        if (null != id) {
            this.userLoginId = Long.parseLong("" + id);
        }
    }

    // ++++++ 业务拓展 +++++++

    @TableField(exist = false)
    private String sysUserName; // 绑定用户名称
}
